﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Resources;
using System.Reflection;

namespace TanHungViet.Helper
{
    public class ResourceUtil
    {
        private static ResourceManager _resManager = null;

        private ResourceUtil()
        {
        }

        public static string AssemblyName = string.Empty;

        public static ResourceManager Instance
        {
            get
            {
                if (_resManager == null)
                    return GetInstance();
                return _resManager;
            }
        }

        private static ResourceManager GetResourceManager(string resourceBaseName, Assembly assembly)
        {
            if (_resManager == null)
                _resManager = new ResourceManager(resourceBaseName, assembly);
            return _resManager;
        }

        private static ResourceManager GetResourceManager(string resourceBaseName)
        {
            AssemblyName = Assembly.GetAssembly(typeof(ResourceUtil)).FullName;
            return GetResourceManager(resourceBaseName, Assembly.GetAssembly(typeof(ResourceUtil)));
        }

        private static ResourceManager GetInstance()
        {
            string resourceBaseName = MethodBase.GetCurrentMethod().DeclaringType.ToString();
            return ResourceUtil.GetResourceManager(resourceBaseName);
        }
    }
}
